refactor(aria/tree): create tree behavior#32569
Conversation
wagnermaciel
commented
Dec 18, 2025
- Create a new Tree behavior and refactor the Tree UI Pattern to use it.
ok7sai
left a comment
There was a problem hiding this comment.
Is this the prework for migrating menu to use the tree behavior?
0ef4766 to
25a2e15
Compare
@ok7sai Yep 👍🏽 |
| * The list of items to navigate through. | ||
| * Defaults to the list of items from the inputs. | ||
| */ | ||
| items?: T[]; |
There was a problem hiding this comment.
The items override feels a bit weird, because whether an override is provided or not, the moving index is always based on the activeIndex from the original input, and the following case becomes hard to reason out.
- ListNavigation is initiated with items A, and an active index of A.
- Navigation happens and a different items B is provided.
- Some logic internally handles the mismatch between active index of A and the items B.
This last part is implicit and not easy to observe.
This makes me think about maybe ListNavigation behavior should just be a set of utility methods, and each method always take all necessary informations (items, activeIndex, wrap, etc.)
There was a problem hiding this comment.
I don't think ListNavigation should be a set of utility methods since it would require a lot of args in order to perform its operations. Either way, this is outside the scope of this PR.
This strange behavior can be replicated by changing the inputs.items currently. We could prevent this misuse of the behavior with some strict checks that warn or error if these come up. I think we are over-anticipating future concerns that I'm not convinced we will actually encounter
8022526 to
1c685ad
Compare
* Create the new Tree Behavior class. * Refactor the existing Tree Pattern class to use the new behavior.
1c685ad to
f89c21b
Compare
* Create the new Tree Behavior class. * Refactor the existing Tree Pattern class to use the new behavior. (cherry picked from commit 21650a6)
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |